|
|
|
|
|
|
|
Many times in an application, you want to center a form (or forms) within the total screen area. Although theres a property you can use to do this, you can also write code, as shown here: |
|
|
|
 |
|
|
|
|
Sub FormCenter(frmCurrent As Form)
Dim intLeft As Integer
Dim intTop As Integer
intLeft = (Screen.Width / 2) _
- (frmCurrent.Width / 2)
intTop = (Screen.Height / 2) _
- (frmCurrent.Height / 2)
frmCurrent.Move intLeft, intTop
End Sub |
|
|
|
|
|
|
|
|
Passing Controls to Procedures |
|
|
|
|
|
|
|
|
Besides passing forms to a generic procedure, you can also pass controls to procedures or functions. This is useful when you have routines that can operate on the same types of controls, such as list boxes and combo boxes. |
|
|
|
|
|
|
|
|
Examples Filename: ObjPassObj.frm |
|
|
|
|
|
|
|
|
Both of the controls on the form shown in Figure 21.2 need to be filled with state names. |
|
|
|
|
|
|
|
|
Figure 21.2
Passing objects to procedures. |
|
|
|
|
|